<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="baseurl" value="${pageContext.request.contextPath}/"></c:set>
<html >
<head>
<link rel="stylesheet" type="text/css" href="${baseurl}CSS/backMange.css">
<!-- css资源 -->
<link rel="stylesheet" type="text/css" href="${baseurl}easyUI1.4.1/themes/default/easyui.css">
<!-- 图标资源 -->
<link rel="stylesheet" type="text/css" href="${baseurl}easyUI1.4.1/themes/icon.css">
<style type="text/css">
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    color: #ccc; opacity:1; 
}

::-moz-placeholder { /* Mozilla Firefox 19+ */
    color: #ccc;opacity:1;
}

input:-ms-input-placeholder{
    color: #ccc;opacity:1;
}

input::-webkit-input-placeholder{
    color: #ccc;opacity:1;
}
.hui_inputClass{background-color: #fff;border:1px #ccc solid;padding: 3px;width: 220px;}
.lan_inputClass{background-color: #fff;border:1px #f37b1b solid;padding: 3px;width: 220px}
</style>
<%-- <link rel="stylesheet" type="text/css" href="${baseurl}common/selectJs/example.css">
<link rel="stylesheet" type="text/css" href="${baseurl}common/selectJs/css/dropkick.css"> --%>
<script type="text/javascript" src="${baseurl}easyUI1.4.1/jquery.min.js"></script>
<!--EasyUI的js包 -->
<script type="text/javascript" src="${baseurl}easyUI1.4.1/jquery.easyui.min.js"></script>
<!-- 本地语言 -->
 <script type="text/javascript" src="${baseurl}easyUI1.4.1/locale/easyui-lang-zh_CN.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script>

//IE不支持console对象，此代码仅为测试使用
///////////////////////////////////////
window.console = window.console || (function () {
var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile  
= c.clear = c.exception = c.trace = c.assert = function () { };  
return c;  
})();


</script>

</head>
<body  style="border: 0px;padding-top:30px;margin:0px;background-color: #f5f5f5;width: 100%;height: auto;min-height: 600px;">
	<div style="width: 87%;height: 85%;margin: 0 auto;background-color: #fff;">
		<div style="width: 100%;padding-top: 10px;">
			<div style="width: 60px;margin: 0px 30px;border-bottom:2px solid #57a0ff;color: #57a0ff;font-size: 15px;padding-bottom: 5px;">
				修改密码
			</div>
			<div style="border-bottom:3px solid #57a0ff;margin: 0px 30px;"></div>
		</div>
		<div style="margin: 10px 50px;padding-top: 20px;">
			<table>
				<tr>
					<td>
						<div style="margin-bottom: 10px;font-size: 14px;">
							旧&nbsp;&nbsp;密&nbsp;&nbsp;码：
						</div>
						
					</td>
					<td>
						<input id="oldPass"class="hui_inputClass"maxlength="16"  type="Password" style="margin-bottom: 10px;"placeholder="请输入旧密码"/>
					</td>
				</tr>
				<tr>
					<td>
						<div style="margin-bottom: 10px;font-size: 14px;">
						新&nbsp;&nbsp;密&nbsp;&nbsp;码：
						</div>
					</td>
					<td>
						<input id="txtNewPass"class="hui_inputClass"maxlength="16"  type="Password" style="margin-bottom: 10px;"placeholder="请输入新密码，限6~16字符"/>
					</td>
				</tr>
				<tr>
					<td>
						<div style="font-size: 14px;">
							
						确认密码：
						</div>
					</td>
					<td>
						<input  id="txtRePass"class="hui_inputClass"maxlength="16"  type="Password"  style=""placeholder="限6~16字符"/>
					</td>
				</tr>
				<tr>
					<td></td>
					<td>
						<div id="info_id" style="min-width: 10px;min-height: 20px;margin-bottom: 8px;padding-left: 10px;font-size: 14px;color:#f37b1b">  </div>
					</td>
				</tr>
				<tr>
					<td></td>
					<td><div style="width: 100px;color: #fff;border-radius: 25px;padding-top: 5px;font-size: 13px;height: 20px;text-align: center;cursor:pointer;background-color: #57a0ff;"onclick="serverLogin()">确认修改</div></td>
				</tr>
			</table>	
		
		</div>
	</div>
</body>

<script>
//错误提示
function valIsNot(id,str){
	if(str == '' || str == null || str == undefined || str == 'undefined'||str.length<6){
		if(str.length<6){
			$("#info_id").text("密码最短为6位");
		}else{
			$("#info_id").text("密码没有填写");
		}
		$("#"+id).attr("class","lan_inputClass");
		setTimeout(function(){
			$("#"+id).attr("class","hui_inputClass");
			setTimeout(function(){
				$("#"+id).attr("class","lan_inputClass");
        		setTimeout(function(){
        			$("#"+id).attr("class","lan_inputClass");
        		},200);
			},200); 
		},200);
		return true;
	}
	return false;
}
//修改密码
function serverLogin() {
	$("#info_id").text("");
	$("#txtRePass").attr("class","hui_inputClass");
	$("#txtNewPass").attr("class","hui_inputClass");
	$("#oldPass").attr("class","hui_inputClass");
	//校验非法字符
	var patrn=/[`~!@#$%^&*()_+<>?:"{},\/;'[\]]/;
	
	//旧密码
	var oldpass = $('#oldPass').val();
	if(valIsNot('oldPass',oldpass)){return;}
	
	//新密码
	var newpass = $('#txtNewPass').val();
	if(valIsNot('txtNewPass',newpass)){return;}
	
	//第二次输入
	var rePass = $('#txtRePass').val();
	if(valIsNot('txtRePass',rePass)){return;}
	
	if(patrn.test(oldpass) || patrn.test(newpass) || patrn.test(rePass)){
		$("#info_id").text('只能输入字母数字！');
        return false;   
	}
	if (oldpass == rePass) {
		$("#info_id").text('新旧密码不能相同！请重新输入');
        return false;
    }
	if (newpass != rePass) {
		$("#info_id").text('两次密码不一致！请重新输入');
        return false;
    }
	var win = $.messager.progress({
		title:'正在加载',
		msg:'请稍候...'
	});
    $.ajax({
        url:'${baseurl}DrivingSys/user/setpassword.action',  
        type: "post",  
        dataType:"json",
        //timeout : 10000,
	    data:{"password":oldpass,
	    	  "newPassword":newpass}, 
        success: function(json) {
        	if(json.rmssData == 'success'){
        		$.messager.progress('close');
        		$.messager.show({
    				title:'提示',
    				msg:'密码 修改成功!',
    				timeout:2000,
    				showType:'slide'
    			});
        		//window.location.href="${baseurl}right.action";
        	}else{
        		$.messager.progress('close');
        		$.messager.alert('系统提示', json.rmssData, 'warning');
        	}
        },error:function(){
        	$.messager.progress('close');
        	$.messager.alert('系统提示', '请刷新页面重试!', 'warning');
        }
    });     
}
</script>
</html>